Conditions | 1 |
Total Lines | 81 |
Code Lines | 71 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | /** |
||
92 | |||
93 | render() { |
||
94 | return ( |
||
95 | <div className="editor-root"> |
||
96 | <ButtonToolbar> |
||
97 | <ButtonGroup style={{ marginLeft: 0 }}> |
||
98 | <Button |
||
99 | bsSize="small" |
||
100 | active={this.state.buttons.BOLD} |
||
101 | onMouseDown={() => this.onToggleInlineStyle('BOLD')} |
||
102 | > |
||
103 | <i className="fa fa-bold" aria-hidden="true" /> |
||
104 | </Button> |
||
105 | </ButtonGroup> |
||
106 | <ButtonGroup> |
||
107 | <Button |
||
108 | bsSize="small" |
||
109 | active={this.state.buttons.ITALIC} |
||
110 | onMouseDown={() => this.onToggleInlineStyle('ITALIC')} |
||
111 | disabled={!config.editor.supportEnhancedFormat} |
||
112 | > |
||
113 | <i className="fa fa-italic" aria-hidden="true" /> |
||
114 | </Button> |
||
115 | <Button |
||
116 | bsSize="small" |
||
117 | active={this.state.buttons.UNDERLINE} |
||
118 | onMouseDown={() => this.onToggleInlineStyle('UNDERLINE')} |
||
119 | disabled={!config.editor.supportEnhancedFormat} |
||
120 | > |
||
121 | <i className="fa fa-underline" aria-hidden="true" /> |
||
122 | </Button> |
||
123 | <Button |
||
124 | bsSize="small" |
||
125 | active={this.state.buttons.STRIKETHROUGH} |
||
126 | onMouseDown={() => this.onToggleInlineStyle('STRIKETHROUGH')} |
||
127 | disabled={!config.editor.supportEnhancedFormat} |
||
128 | > |
||
129 | <i className="fa fa-strikethrough" aria-hidden="true" /> |
||
130 | </Button> |
||
131 | <Button |
||
132 | bsSize="small" |
||
133 | active={this.state.buttons['unordered-list-item']} |
||
134 | onMouseDown={() => this.onToggleBlockType('unordered-list-item')} |
||
135 | disabled={!config.editor.supportEnhancedFormat} |
||
136 | > |
||
137 | <i className="fa fa-list-ul" aria-hidden="true" /> |
||
138 | </Button> |
||
139 | <Button |
||
140 | bsSize="small" |
||
141 | active={this.state.buttons['ordered-list-item']} |
||
142 | onMouseDown={() => this.onToggleBlockType('ordered-list-item')} |
||
143 | disabled={!config.editor.supportEnhancedFormat} |
||
144 | > |
||
145 | <i className="fa fa-list-ol" aria-hidden="true" /> |
||
146 | </Button> |
||
147 | </ButtonGroup> |
||
148 | { !config.editor.supportEnhancedFormat && |
||
149 | <div |
||
150 | style={{ |
||
151 | width: '160px', |
||
152 | height: '30px', |
||
153 | position: 'relative', |
||
154 | left: '36px', |
||
155 | backgroundColor: 'rgba(228, 228, 228, 0.6)', |
||
156 | color: '#8e8e8e', |
||
157 | textAlign: 'center', |
||
158 | lineHeight: '30px', |
||
159 | }} |
||
160 | > |
||
161 | <div style={{ position: 'absolute', width: '100%', fontSize: '12px' }}>추후 지원 예정</div> |
||
162 | </div> |
||
163 | } |
||
164 | </ButtonToolbar> |
||
165 | <Editor |
||
166 | className="RichEditor-editor" |
||
167 | editorState={this.state.editorState} |
||
168 | onChange={s => this.onChange(s)} |
||
169 | onTab={e => this.onTab(e)} |
||
170 | placeholder={this.props.placeholder} |
||
171 | /> |
||
172 | </div> |
||
173 | ); |
||
187 |